package cn.hyy.controller;

import cn.hyy.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class ServiceAController {
    @Autowired
    private RestTemplate restTemplate;
    @GetMapping("/test/{id}")
    public User getById(@PathVariable("id") Long id){
        String url = "SERVICE-E";
        User user = restTemplate.getForObject("http://" + url + "/test/1", User.class);
        System.out.println("user===="+user);
        return user;
    }

}
